/**
 * ----------------------------------------------------------------------------|
 * Created on Apr 12, 2003
 */
package org.jgap.test;

import java.util.List;
import java.util.Properties;
import java.util.Random;

import org.jgap.BulkFitnessFunction;
import org.jgap.Chromosome;

/**
 * @author Philip Tucker
 */
public class DummyFitnessFunction implements BulkFitnessFunction {
  
  private static final long serialVersionUID = -3998920485315200997L;
  
  private Random rand = null;

  /**
   * ctor
   * @param newRand
   */
  public DummyFitnessFunction(Random newRand) {
    rand = newRand;
  }

  /**
   * ctor
   */
  public DummyFitnessFunction() {
    rand = new Random();
  }

  /**
   * @see org.jgap.FitnessFunction#init(java.util.Properties)
   */
  public void init(Properties newProps) {
    // no-op
  }

  public void evaluate(List<Chromosome> subjects) {
    for (Chromosome subject : subjects) {
      subject.setFitnessValue(rand.nextInt(100));
    }
  }

  public int getMaxFitnessValue() {
    return 100;
  }

}
